package helloworld.rmi;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.Registry;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author wuyang
 */
public class HelloworldClient {

	public static void main(String[] args) {
		try {
			String host = "192.168.1.108";
			Helloworld helloworld = (Helloworld) Naming.lookup("rmi://" + host
					+ ":" + Registry.REGISTRY_PORT + "/Hello");
			System.out.println(helloworld.sayHelloworld());
		} catch (NotBoundException ex) {
			Logger.getLogger(HelloworldClient.class.getName()).log(
					Level.SEVERE, null, ex);
		} catch (MalformedURLException ex) {
			Logger.getLogger(HelloworldClient.class.getName()).log(
					Level.SEVERE, null, ex);
		} catch (RemoteException ex) {
			Logger.getLogger(HelloworldClient.class.getName()).log(
					Level.SEVERE, null, ex);
		}
	}
}